feat(ai): integrate Vertex AI Gemini with MCP for code analysis#25
Merged
feat(ai): integrate Vertex AI Gemini with MCP for code analysis#25
Conversation
- Add GeminiClient for Vertex AI integration with gemini-1.5-flash/pro models - Implement Model Context Protocol (MCP) with OWASP Top 10 security contexts - Create AIService as orchestrator for AI-powered code analysis - Add SecurityContext dataclass for structured prompt engineering - Fix Clerk JWT authentication to support HS256 with Custom JWT Templates - Update auth_service to use standard 'sub' claim from JWT payload - Fix Severity enum to use uppercase values matching database schema - Add comprehensive unit tests for AI components (88%+ coverage) - Configure GCP credentials for Vertex AI authentication BREAKING CHANGE: Severity enum values changed from lowercase to UPPERCASE Closes CGAI-32
…tegration-GenerativeAI
- Change severity ordering list from lowercase to UPPERCASE in performance_agent.py
- Update expected_order in integration test to match Severity enum values
- Fixes ValueError: 'HIGH' is not in list during findings sorting
The Severity enum uses UPPERCASE values ('CRITICAL', 'HIGH', etc.) but the
sorting list used lowercase, causing index lookup failures.
Fixes 2 failing tests:
- test_comprehensive_performance_detection
- test_detect_triple_nested_loops_critical
…mprove formatting
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📝 Descripción
Implementación completa de Sprint 3: IA Generativa integrando Google Vertex AI (Gemini) con el Model Context Protocol (MCP) para análisis de código inteligente.
Componentes Principales:
gemini-1.5-flash-001(dev) ygemini-1.5-pro-001(prod)Fixes Adicionales:
suben lugar deuser_id🎯 Historia de Usuario Relacionada
Closes #32 (CGAI-32: Integration Generative AI - Vertex AI + MCP)
🧪 Cómo se Probó
sub✅ Checklist Previo al Merge
pytest)📁 Archivos Modificados
Nuevos Archivos
src/services/ai_service.pysrc/external/gemini_client.pysrc/config/mcp_config.pytests/test_ai_service.pyArchivos Modificados
src/external/clerk_client.pysrc/services/auth_service.pysubdel JWTsrc/core/settings.pyCLERK_JWT_SIGNING_KEYsrc/schemas/finding.pysrc/agents/security_agent.pysrc/agents/quality_agent.pytests/unit/external/test_clerk_client.pytests/unit/services/test_auth_service.pysubtests/integration/test_auth_router.pysub🔧 Configuración Requerida